package Se.Protocol;

//客户端发送到服务端
message ServerMessage{
	enum ServerType { ErrorInfo = 2; Login = 3; Register = 4; Chat = 5; CreatePlayer = 6;}

	required ServerType Type = 1;

	optional ErrorInfo errorInfo = 2;

	optional Login login = 3;

	optional Register register = 4;

	optional Chat chat = 5;

	optional CreatePlayer createPlayer = 6;
}

//服务端发送到客户端
message ClientMessage{
	enum ClientType { ErrorInfo = 2; LoginOK = 3; RegisterOK= 4; UpdateChatMsg = 5; CreatePlayerSuccess = 6; }

	required ClientType Type = 1;

	optional ErrorInfo errorInfo = 2;

	optional LoginOK loginOK = 3;

	optional RegisterOK registerOK = 4;

	optional UpdateChatMsg updateChatMsg = 5;

	optional CreatePlayerSuccess createPlayerSuccess = 6;
}

message ErrorInfo{
	required int32 ErrorType = 1;
	required string msg = 2;
}

//注册
message Register{
  required string UserName = 1;
  required string Pwd = 2;
}

//注册成功
message RegisterOK{
  required int64 AccountID = 1;
  required string UserName = 2;
}

//登录
message Login{
  required string UserName = 1;
  required string Pwd = 2;
}

//登录成功
message LoginOK{
  required int64 AccountID = 1;
  required string UserName = 2;
  optional string Message = 3;
}

//请求聊天
message Chat{
	required int32 MsgType = 1;
	required string Message = 2;
}

//返回聊天内容更新
message UpdateChatMsg{
	repeated ChatMsg Content = 1;
}

//聊天内容
message ChatMsg{
	required int32 MsgType = 1;
	required string Name = 2;
	required string Msg = 3;
}

//创建角色
message CreatePlayer{
	required string name = 1;
	//角色类型
	required int32 roleTypeID = 2;
}

//创建角色成功
message CreatePlayerSuccess{
	required int64 id = 1;
	required string name = 2;
	required int32 roleTypeID = 3;
}

